N=int(raw_input())
jiahe,yihe = 0,0
while N>0:
    inputs=map(int, raw_input().split(' '))
    (jiahan,jiahua,yihan,yihua)=inputs
    #print jiahan,jiahua,yihan,yihua
    if jiahua != yihua:
        if jiahan+yihan == jiahua:
            yihe+=1
        elif jiahan+yihan == yihua:
            jiahe+=1
    N-=1

print str(jiahe)+' '+str(yihe)